package Servlet;

import Bean.LoginBean;
import Dao.Impl.StuDaoImpl;
import Dao.Impl.TeaDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/FindClassServlet")
public class FindClassServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");

        String str1=req.getParameter("id");
        String str2=req.getParameter("password");

        HttpSession session = req.getSession();

        String str=req.getParameter("class");

        StuDaoImpl stu=new StuDaoImpl();

        try {
            session.setAttribute("users",stu.FindCalss(str));
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        req.setAttribute("Msg1", null);
        req.setAttribute("Msg11", null);
        req.setAttribute("Msg2", "layui-this");
        req.setAttribute("Msg22", "layui-show");
        req.setAttribute("Msg3", null);
        req.setAttribute("Msg33", null);
        req.setAttribute("Msg4", null);
        req.setAttribute("Msg44", null);
        req.setAttribute("Msg5", null);
        req.setAttribute("Msg55", null);
        req.setAttribute("Msg6", null);
        req.setAttribute("Msg66", null);

        req.setAttribute("uzhanghao", str1);
        req.setAttribute("umima", str2);
        req.getRequestDispatcher("tea_welcome.jsp").forward(req,resp);

    }
}
